1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17"></td>
4       </tr>
5     </table>
6 <?
7     
switch ($_GET['action'])
8     {
9         
case 'del' :
10             $id = $_GET[
'id'];
11             $sql =
"delete from email where id='".$id."'";
12             @$result = mysql_query($sql,$con);
13             
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
14             
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
15             
break;
16     }
17 ?>
18
19 <?
20     
if (isset($_POST['ButDel'])) {
21         $cnt=
0;
22         
foreach ($_POST['chk'] as $id)
23         {
24             @$result = mysql_query(
"delete from email where id='".$id."'",$con);
25             
if ($result) $cnt++;
26         }
27         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
28     }
29 ?>
30 <?
31     $page = $_GET[
"page"];
32     $MAXPAGE=
40;
33     $p=
0;
34     
if ($page!='') $p=$page;
35 ?>
36 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
37 <input type=
"hidden" name="act" value="email">
38 <input type=hidden name=
"page" value="<? echo $page; ?>">
39 <?
40 function taotrang($sql,$link,$nitem,$itemcurrent)
41 {
global $con;
42     $ret=
"";
43     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
44     $
value = mysql_fetch_array($result);
45     $plus = (($
value['cnt'] % $nitem)>0);
46     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
47     {
48         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
49         
else $ret .= ($i+1)." ";
50     }
51     
return $ret;
52 }
53     $pageindex=taotrang(
"select count(*) from email","./?act=email"."&page=",$MAXPAGE,$page);
54 ?>
55
56 <table cellspacing=
"0" cellpadding="0">
57 <tr>
58 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
59 </tr>
60 </table>
61
62 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
63   <tr>
64     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
65     <td nowrap
class="title">&nbsp;</td>
66     <td nowrap
class="title">&nbsp;</td>
67     <td align=
"center" nowrap class="title"><b>ID</b></td>
68     <td align=
"center" nowrap class="title"><b>Email</b></td>
69     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
70   </tr>
71   
72   <?
73                 $sql=
"select * from email order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
74                 $result=mysql_query($sql,$con);
75                 $i=
0;
76                 
while(($row=mysql_fetch_array($result)))
77                 {
78                     $i++;
79                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
80   ?>
81   
82   <tr>
83     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
84     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
85     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
86     </td>
87     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
88     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=email&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
89     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
90     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['email']; ?>&nbsp;</td>
91     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
92   </tr>
93   <?
94                 }
95   ?>
96 </table>
97 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
98 </form>
99 <script language=
"JavaScript">
100 function chkallClick(o) {
101     
var form = document.frmList;
102     
for (var i = 0; i < form.elements.length; i++) {
103         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
104             form.elements[i].
checked = document.frmList.chkall.checked;
105         }
106     }
107 }
108 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.916 lượt xem

Gõ tìm kiếm nhanh...